home *** CD-ROM | disk | FTP | other *** search
- /*
- Header: PtrDebug
- Version: 1.00
-
- Language: ANSI C
- Environ: Any
-
- Purpose: Provides debug replacements for the standard
- dynamic memory allocation functions.
-
- Written by: Scott Robert Ladd
- */
-
- #if !defined(_PTRDEBUG_H)
- #define _PTRDEBUG_H
-
- #include "stddef.h"
-
- /* change calls to traditional functions to call debug functions */
-
- #if !defined(NO_PTRDEBUG_DEF)
- #define malloc(a) dbg_malloc(a,__FILE__,__LINE__)
- #define calloc(a,b) dbg_calloc(a,b,__FILE__,__LINE__)
- #define realloc(a,b) dbg_realloc(a,b,__FILE__,__LINE__)
- #define free(a) dbg_free(&a,__FILE__,__LINE__)
- #define strdup(a) dbg_strdup(a,__FILE__,__LINE__)
- #endif
-
- /* prototypes for debug functions */
-
- void * dbg_malloc(size_t len, char * file, int line);
-
- void * dbg_calloc(size_t num, size_t len, char * file, int line);
-
- void * dbg_realloc(void * ptr, size_t len, char * file, int line);
-
- void dbg_free(void ** ptr, char * file, int line);
-
- char * dbg_strdup(char * str, char * file, int line);
-
- #endif
-